package zhtt.mongo.repository;

import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import zhtt.mongo.entity.User;

import java.util.List;

/**
 * Created by zhaott on 2018/3/20.
 */
public interface UserRepository extends MongoRepository<User, String> {

    List<User> findByName(String name);

    List<User> findByNameLike(String name);

    List<User> findByNameAndAge(String name, int age);

    List<User> getByAge(String age);

    @Query("{age:12}")
    List<User> findChucksOrders();
}
